﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using RedDragon.RBAC.API.Application.Common.Client;
using RedDragon.RBAC.API.Application.Common.Sale;
using RedDragon.RBAC.API.Application.Common.Storehouse;
using T.Common.Domain.Common;

namespace RedDragon.RBAC.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class StorehouseController : ControllerBase
    {
        /// <summary>
        /// 
        /// </summary>
        private readonly IMediator mediator;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mediator">mediator</param>
        public StorehouseController(IMediator mediator)
        {
            this.mediator = mediator;
        }

        /// <summary>
        /// 入库添加
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> addstorehouse(AddstorehouseCommand cmd)
        {
            return await mediator.Send(cmd);
        }


        /// <summary>
        /// 入库列表
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> showStorehouse(ShowStorehouseCommand cmd)
        {
            return await mediator.Send(cmd);
        }
        /// <summary>
        /// 入库删除
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpDelete]
        public async Task<Result> Deletetorehouse(DeletetorehouseCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 根据入库id获取信息
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<Result> findStorehouse(FindStorehouseCommand cmd)
        {
            return await mediator.Send(cmd);
        }

        /// <summary>
        /// 入库修改
        /// </summary>
        /// <param name="cmd"></param>
        /// <returns></returns>
        [HttpPut]
        public async Task<Result> updateStorehouse(UpdateStorehouseCommand cmd)
        {
            return await mediator.Send(cmd);
        }


    }
}
